﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DaHuaSheJiMoShi
{
    class TestDaHua
    {
        public void Test()
        {
            Cat cat = new Cat();
            cat.ShoutNum = 10;
            Dog dog = new Dog();
            Dog dog1=new Dog("dge");

        }
    }

    class Animal
    {
        protected string name = "";

        public Animal(string name)
        {
            this.name = name;
        }

        public Animal()
        {
            this.name = "无名";
        }

        protected int shoutNum = 3;

        public int ShoutNum
        {
            get => shoutNum;
            set => shoutNum = value;
        }
    }

    class Dog : Animal
    {
        public Dog() : base() { }
        public Dog(string name) : base() { }
    }
    class Cat
    {
        private int shoutNum = 3;
        /// <summary>
        /// 对shoutNum的值进行限制的方法
        /// </summary>
        public int ShoutNum
        {
            get => shoutNum;
            set => shoutNum = value < 10 ? value : 10;
        }
    }
}
